package com.vegetable.modules.mapper.outbound;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vegetable.modules.entity.outbound.SalesOrder;
import com.vegetable.modules.entity.outbound.SalesOrderDetail;
import com.vegetable.modules.entity.outbound.po.CustomerPurchaseAnalysisPO;
import com.vegetable.modules.entity.outbound.po.NoCostWeightListPO;
import com.vegetable.modules.entity.outbound.po.SalesOrderTransmitPO;
import com.vegetable.modules.entity.outbound.vo.CustomerPurchaseAnalysisVO;
import com.vegetable.modules.entity.outbound.vo.NoCostWeightListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 销售订货 Mapper 接口
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-27
 */
@Mapper
public interface SalesOrderMapper extends BaseMapper<SalesOrder> {

    /**
     * 生成流水单号
     * @return
     */
    String getNextCode();

    IPage<NoCostWeightListVO> noCostWeightList(IPage page, NoCostWeightListPO po);

    List<SalesOrderDetail> selectDetailList(SalesOrderTransmitPO po);
    
    /**
     * 分析客户采购习惯
     * @param page 分页对象
     * @param po 查询参数
     * @return 客户采购习惯分析结果
     */
    IPage<CustomerPurchaseAnalysisVO> analyzeCustomerPurchase(IPage page, @Param("po") CustomerPurchaseAnalysisPO po);
    
    /**
     * 统计客户采购习惯记录数
     * @param po 查询参数
     * @return 记录数
     */
    int countCustomerPurchase(@Param("po") CustomerPurchaseAnalysisPO po);
}